// 组合继承

function SuperType(name) {
  this.name = name
  this.colors = ['red', 'green', 'blue']
}


SuperType.prototype.sayName = function () {
  console.log(this.name);
}

function SubType(name, age) {
  SuperType.call(this,name)
  this.age = age
}
SubType.prototype = new SuperType()

SubType.prototype.sayAge = function () {
  console.log(this.age);
}


var instance1 = new SubType('kk', 18)
var instance2 = new SubType('ov', 20)

instance1.colors.push('pink')
console.log(instance1.colors);
instance1.sayName()
instance1.sayAge()


console.log(instance2.colors);
instance2.sayName()
instance2.sayAge()
